package cn.tedu.jewelry.controller;

import cn.tedu.jewelry.entity.Cart;
import cn.tedu.jewelry.entity.Collect;
import cn.tedu.jewelry.mapper.CartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

//购物车
@RestController
@RequestMapping("/index")
public class CartController {
    @Autowired(required = false)
    CartMapper mapper;

    //购物车商品列表
    @RequestMapping("/cartList")
    public List<Cart>cartList(Integer userid) {
        System.out.println("--1--"+userid);
        List<Cart> list = mapper.cartList(userid);
        System.out.println("--2--"+list);
        return list;
    }
    //删除购物车商品
    @RequestMapping("/cartDelete")
    public void delete(int id){
        mapper.deleteById(id);
    }




}
